home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / SPRAY.ZIP / SPRAY.TXT < prev    next >
Encoding:
Text File  |  1997-05-23  |  23.5 KB  |  593 lines

  1. **************************************************************************
  2. **************************************************************************
  3.          LIQUID SPRAY INCLUDE FILE FOR PERSISTENCE OF VISION 3.x
  4. **************************************************************************
  5. **************************************************************************
  6.  
  7. Created by Chris Colefax, 23 May 1997
  8.  
  9. 1.0  INSTALLATION
  10. 2.0  QUICK START
  11. 3.0  OPTIONS
  12.         3.1  BASIC OPTIONS
  13.                 3.1.1  spray_location
  14.                 3.1.2  spray_direction
  15.                 3.1.3  spray_strength
  16.         3.2  TIME OPTIONS
  17.                 3.2.1  spray_loop
  18.                 3.2.2  spray_start
  19.                 3.2.3  spray_stop
  20.                 3.2.4  spray_start_time
  21.                 3.2.5  spray_stop_time
  22.         3.3  PARTICLE OPTIONS
  23.                 3.3.1  particle_count
  24.                 3.3.2  particle_life
  25.                 3.3.3  particle_size
  26.                 3.3.4  particle_stretch
  27.                 3.3.5  particle_dist
  28.                 3.3.6  particle_sep
  29.                 3.3.7  evaporate
  30.         3.4  NOZZLE OPTIONS
  31.                 3.4.1  nozzle_spin
  32.                 3.4.2  nozzle_angle
  33.                 3.4.3  nozzle_width
  34.         3.5  BLOB OPTIONS
  35.                 3.5.1  use_blob
  36.                 3.5.2  blob_threshold
  37.                 3.5.3  components_only
  38.         3.6  ENVIRONMENT OPTIONS
  39.                 3.6.1  spray_gravity
  40.                 3.6.2  spray_sky
  41.                 3.6.3  wind
  42.         3.7  GROUND PLANE OPTIONS
  43.                 3.7.1  ground_plane
  44.                 3.7.2  ground_dist
  45.                 3.7.3  ground_reflection
  46.                 3.7.4  max_bounces
  47.                 3.7.5  ground_friction
  48.                 3.7.6  puddle_thickness
  49.                 3.7.7  puddle_scale
  50.         3.8  TEXTURE OPTIONS
  51.                 3.8.1  spray_texture
  52.                 3.8.2  spray_color_map
  53.                 3.8.3  use_color_map
  54.                 3.8.4  color_map_triangle
  55.                 3.8.5  color_map_frequency
  56.         3.9  TURBULENCE OPTIONS
  57.                 3.9.1  spray_turb
  58.                 3.9.2  scale_turb
  59.                 3.9.3  vel_turb
  60.                 3.9.4  angle_turb
  61.                 3.9.5  spin_turb
  62.                 3.9.6  color_turb
  63.                 3.9.7  wind_turb
  64.                 3.9.8  spray_seed
  65.         3.10  OTHER OPTIONS
  66.                 3.10.1  spray_clock
  67.                 3.10.2  time_scale
  68.                 3.10.3  flow_rate
  69.  
  70. 4.0  COPYRIGHT AND LEGAL INFORMATION
  71. 5.0  CONTACTING THE AUTHOR
  72.  
  73. **************************************************************************
  74.  
  75.  
  76. 1.0  INSTALLATION
  77. **************************************************************************
  78. Copy the two INC files (Spray.inc and SprayG.inc) to one of the
  79. directories (folders) in your POVRay library path.  Normally this is the
  80. INCLUDE sub-directory of the directory where you installed POVRay, so if
  81. you installed POVRay in C:\POVRAY you should copy the files to 
  82. C:\POVRAY\INCLUDE.  On a Windows 95 system, this is probably something 
  83. like:
  84.  
  85.    C:\Program Files\POV-Ray for Windows\Include
  86.  
  87. On UNIX and similar systems, where filenames are case-sensitive, you may
  88. have to rename the include files to Spray.inc and SprayG.inc, with
  89. uppercase and lowercase as shown.  This will enable you to render the
  90. sample files without modification.
  91.  
  92.  
  93. 2.0  QUICK START
  94. **************************************************************************
  95. The Liquid Spray include file allows you to generate a whole range of
  96. spray-type particle objects, such as fountains, hoses, waterfalls, etc.
  97. It will even generate fireworks!  There are many options you can use to
  98. affect the way the spray is generated; to use any of these you simply add
  99. the following line to your POVRay scene file:
  100.  
  101.    #declare [variable-name] = [value]
  102.  
  103. substituting the desired variable name and value where appropriate.  After
  104. you have declared all the options you want to use, you add the following
  105. line to your POVRay scene file:
  106.  
  107.    #include "Spray.inc"
  108.  
  109. The Liquid Spray include file will then automatically create the spray
  110. object for you.  Although you don't have to use any of the options (the
  111. include file will use defaults if you don't specify a variable), you
  112. will want to use the options listed below to ensure you get the sort of
  113. spray object that you want.
  114.  
  115.  
  116. 3.0  OPTIONS
  117. **************************************************************************
  118.  
  119. 3.1  BASIC OPTIONS
  120. ******************
  121. The variables in this section control the basic features of the liquid
  122. spray, and should generally be the first variables you declare.
  123.  
  124. 3.1.1  spray_location
  125. *********************
  126. This vector specifies the point from where the spray object originates,
  127. ie. the point where the spray particles first appear.
  128. The default value for spray_location is <0, 0, 0>
  129.  
  130. 3.1.2  spray_direction
  131. **********************
  132. This vector specifies the direction of the spray object, ie. the initial
  133. direction of the spray particles.
  134. The default value for spray_direction is <0, 1, 0>
  135.  
  136. 3.1.3  spray_strength
  137. *********************
  138. This number specifies the strength of the spray object, ie. the initial
  139. speed of the spray particles.
  140. The default value for spray_strength is the length of the spray_direction.
  141.  
  142.  
  143. 3.2  TIME OPTIONS
  144. *****************
  145. The following variables control how the spray object is animated (in
  146. relation to POVRay's clock variable).
  147.  
  148. 3.2.1  spray_loop
  149. *****************
  150. This true / false variable specifies whether or not to generate a
  151. perpetually looping spray object (for cyclic animations).  If spray_loop
  152. is true, then the spray object will be visible throughout the animation,
  153. and it will have a constant spray_strength.  If spray_loop is false, you
  154. can use the following options to control how the spray object is turned
  155. on or off:
  156.  
  157. 3.2.2  spray_start
  158. ******************
  159. This number specifies the time to turn on the spray object, eg. if you
  160. use spray_start = .5 then the spray will turn on halfway through the
  161. animation (presuming the animation clock goes from 0 to 1).
  162. The default value for spray_start is 0
  163.  
  164. 3.2.3  spray_stop
  165. *****************
  166. This number specifies the time to turn off the spray object, eg. if you
  167. use spray_stop = .5 then the spray will turn off halfway through the
  168. animation.
  169. The default value for spray_stop is 1
  170.  
  171. 3.2.4  spray_start_time
  172. ***********************
  173. This numbers specifies the time it takes for the spray to reach full
  174. strength, eg. if you use spray_start = .1 and spray_start_time = .3 then
  175. the spray object will reach full strength at .4
  176. The default value for spray_start_time is 0
  177.  
  178. 3.2.5  spray_stop_time
  179. **********************
  180. This numbers specifies the time it takes for the spray to turn off, eg.
  181. if you use spray_stop = .7 and spray_stop_time = .2 then the spray object
  182. will start to run down at .5, and be fully stopped by .7
  183. The default value for spray_stop_time is 0
  184.  
  185.  
  186. 3.3  PARTICLE OPTIONS
  187. *********************
  188. Each spray object contains a number of particles.  You can use the options
  189. in this section to specify the characteristics of these particles.
  190.  
  191. 3.3.1  particle_count
  192. *********************
  193. This number specifies the number of particles used to create the spray
  194. object.  If spray_loop is true, then the spray object will always contain
  195. the same number of particles.  If spray_loop is false, then the number of
  196. particles will change as the spray is turned on and off.
  197. The default value for particle_count is 100
  198.  
  199. 3.3.2  particle_life
  200. ********************
  201. This number specifies how long each particle is alive, eg. if you use
  202. particle_life = 1.5, then each particle will disappear after 1.5 units
  203. of time.  If spray_loop is true, then the spray object will be automatically
  204. adjusted so it always loops correctly.
  205. The default value for particle_life is 1
  206.  
  207. 3.3.3  particle_size
  208. ********************
  209. This number specifies the size (in POV units) of each spray particle.  It
  210. is actually the radius of the spheres or blob components that make up the
  211. spray object.
  212. The default value for particle_size is 1
  213.  
  214. 3.3.4  particle_stretch
  215. ***********************
  216. This number specifies how much to stretch the spray particles by.  Numbers
  217. larger than one make the particle thinner and torpedo shaped, giving the
  218. effect of movement.  Numbers smaller than one make the particles look like
  219. discs (not recommended).
  220. The default value for particle_stretch is 1 (ie. no stretch)
  221.  
  222. 3.3.5  particle_dist
  223. ********************
  224. This option can be used to generate a mixture of larger and smaller
  225. particles, rather than all the particles being the same size.  The number
  226. used specifies the size distribution of the particles, ie. the ratio of
  227. small particles to large particles:
  228.    1 - equal numbers of small and large particles
  229.    0 - all large particles
  230.    between 0 and 1 - more large particles than small particles
  231.    larger than 1 - more small particles than large particles
  232. The default value for particle_dist is 1
  233.  
  234. 3.3.6  particle_sep
  235. *******************
  236. This option can be used to separate the smaller particles from the larger
  237. particles, giving the effect of a fine spray surrounding the main spray
  238. object.  It has no effect if particle_dist is 0.  Setting particle_sep
  239. to 0 specifies no separation between the differently sized particles,
  240. while numbers larger than 0 increase the separation.
  241. The default value for particle_sep is 0
  242.  
  243. 3.3.7  evaporate
  244. ****************
  245. This number specifies the rate of evaporation of the particles.  Setting
  246. this option to 0 specifies no evaporation, while numbers larger than 0
  247. will cause the particles to grow smaller until they disappear at the end
  248. of their lives (see particle_life above).  The larger the number, the
  249. faster the particles disappear.
  250. The default value for evaporate is false (0)
  251.  
  252.  
  253. 3.4  NOZZLE OPTIONS
  254. *******************
  255. The following options control the characteristics of the spray nozzle:
  256.  
  257. 3.4.1  nozzle_spin
  258. ******************
  259. This option specifies the number of spins the nozzle makes per unit of
  260. time.  Setting nozzle_spin to 0 will stop the nozzle from spinning.
  261. Negative numbers can be used to spin the nozzle in the opposite direction.
  262. The default value for nozzle_spin is 1
  263.  
  264. 3.4.2  nozzle_angle
  265. *******************
  266. This option specifies the angle (in degrees) of the spray nozzle.  If you
  267. think of the spray object as a cone, with its apex at spray_location, this
  268. number is the angle at the apex of the cone (similar to the radius option
  269. in POVRay's spotlight).
  270. The default value for nozzle_angle is 20
  271.  
  272. 3.4.3  nozzle_width
  273. *******************
  274. This option can be used to widen the nozzle, for waterfalls and other
  275. similar spray objects.
  276. The default value for nozzle_width is 0
  277.  
  278.  
  279. 3.5  BLOB OPTIONS
  280. *****************
  281. Normally the spray object is generated as a union of spheres.  You can use
  282. the following options to generate the spray object as a blob object
  283. instead:
  284.  
  285. 3.5.1  use_blob
  286. ***************
  287. Setting this option to true will cause the spray object to be generated
  288. as a blob.
  289. The default value for use_blob is false
  290.  
  291. 3.5.2  blob_threshold
  292. *********************
  293. This number specifies the threshold of the blob used to create the spray
  294. object (see the POVRay docs for more information on blob thresholds).
  295. The default value for blob_threshold is .5
  296.  
  297. 3.5.3  components_only
  298. **********************
  299. This option can be used to generate blob components only, rather than a
  300. complete blob object.  This is useful when you want to combine the liquid
  301. spray blob with another blob (so the components interact).  You will have
  302. to place the include statement inside the blob {} object, and apply
  303. textures manually.  For an example of this, see the sample scenes that
  304. came with the Liquid Spray include file.
  305. The default value for components_only is false
  306.  
  307.  
  308. 3.6  ENVIRONMENT OPTIONS
  309. ************************
  310. The following options can be used to alter the environment in which the
  311. spray object is created:
  312.  
  313. 3.6.1  spray_gravity
  314. ********************
  315. This number specifies the strength of the gravity force applied to the
  316. spray particles.  Only positive numbers are accepted; the gravity force
  317. is always in an opposite direction to the spray_sky vector.
  318. The default value for spray_gravity is 9.8
  319.  
  320. 3.6.2  spray_sky
  321. ****************
  322. This specifies the direction vector that points in the up direction.
  323. It works in a similar way to the sky keyword in the POVRay camera, and
  324. it useful when using a different coordinate system (eg. use
  325. spray_sky = z if the z-axis points upwards).  This vector determines the
  326. direction of the gravity (opposite to the sky, of course) and is also
  327. used as the normal of the ground plane, if one is specified (see
  328. section 3.7).
  329. The default value for spray_sky is <0, 1, 0>
  330.  
  331. 3.6.3  wind
  332. ***********
  333. You can use the wind option to blow the spray particles in a particular
  334. direction.  The direction of the wind vector is the direction in which
  335. the wind blows, and the size of the wind vector determines the strength
  336. of the wind force.
  337. The default value for wind is <0, 0, 0> (no wind)
  338.  
  339.  
  340. 3.7  GROUND PLANE OPTIONS
  341. *************************
  342. The Liquid Spray include file has the ability to add a ground plane
  343. to the scene.  If a spray particle hits this ground plane it can
  344. automatically splash off it or it can form puddles on the plane.
  345. Note that the Liquid Spray include file will not actually create a
  346. ground plane object for you, giving you the option to use any sort of
  347. object you like to represent the ground.
  348.  
  349. 3.7.1  ground_plane
  350. *******************
  351. This is a true/false value that indicates whether a ground plane is
  352. present or not.
  353. The default value for ground_plane is false
  354.  
  355. 3.7.2  ground_dist
  356. ******************
  357. This specifies the distance of the ground from the origin, and is the
  358. same as the distance value as specified in the plane object.  Note that
  359. the normal direction of the plane is always the same as spray_sky.
  360. The default value for ground_dist is 0
  361.  
  362. 3.7.3  ground_reflection
  363. ************************
  364. This specifies the amount of energy a spray particle retains after splashing
  365. off the ground plane.  Setting ground_reflection to 1 means that the particle
  366. retains all its energy, and will bounce back to the same height each time
  367. it splashes.  Setting ground_reflection to 0 means that the particle
  368. retains none of it's energy after hitting the plane, and therefore it
  369. forms a puddle.  Values in between 0 and 1 will cause the particle to
  370. splash less high each time it hits the plane, eventually coming to a stop.
  371. The default value for ground_reflection is .8
  372.  
  373. 3.7.4  max_bounces
  374. ******************
  375. This option specifies the maximum number of times a spray particle will
  376. splash off the ground plane before forming a puddle.
  377. The default value for max_bounces is 1
  378.  
  379. 3.7.5  ground_friction
  380. **********************
  381. After a spray particle stops splashing it will form a puddle which slides
  382. along the ground.  The ground_friction options specifies how quickly the
  383. spray particle stops moving after it forms a puddle.  Setting this option
  384. to 0 causes the particle to stop as soon as it hits the ground.  Setting
  385. this option to 1 causes the particle to slide along without stopping.
  386. Numbers in between 0 and 1 bring the particle to a gradual stop.
  387. The default value for ground_friction is .5
  388.  
  389. 3.7.6  puddle_thickness
  390. ***********************
  391. This number specifies how thick the puddles formed by the spray particle
  392. will be.  Setting this option to 1 means that the puddles are as thick as
  393. original particles, while smaller numbers make the puddles thinner (and
  394. wider).
  395. The default value for puddle_thickness is .3
  396.  
  397. 3.7.7  puddle_scale
  398. *******************
  399. You can use this option to artificially alter the size of the puddles, eg.
  400. puddle_scale = 2 will make the puddles twice as large as normal.  This
  401. is most useful when using blobs (see section 3.5 above), as thin blobs can
  402. sometimes cause rendering problems.
  403. The default value for puddle_scale is 1 (no change in puddle size)
  404.  
  405.  
  406. 3.8  TEXTURE OPTIONS
  407. ********************
  408. The following options can be used to change the texture and colour of the
  409. spray object and its particles:
  410.  
  411. 3.8.1  spray_texture
  412. ********************
  413. This specifies the texture used for the spray object.  You can use the
  414. name of a predefined texture, eg: #declare spray_texture = MyTexture, or
  415. you can specify a complete texture within a texture {} statement.
  416. By default a plain blue texture is used.
  417.  
  418. 3.8.2  spray_color_map
  419. **********************
  420. You can use this option to change the color of the spray object over time.
  421. This option should be declared as a standard color_map, eg:
  422.  
  423.    #declare spray_color_map =
  424.       color_map {[0 rgb <1, 1, 1>] [1 rgb <0, 0, 0>]}
  425.  
  426. This will cause the spray to gradually change from white at the beginning
  427. of the animation, to black at the end of the animation.
  428.  
  429. 3.8.3  use_color_map
  430. ********************
  431. You can set this option to false to turn OFF the color_map if you are
  432. creating multiple spray objects and have already declared spray_color_map,
  433. which you no longer want to use.
  434.  
  435. 3.8.4  color_map_triangle
  436. *************************
  437. Setting this option to true will cause the color_map to go from 0 to 1,
  438. and back to 0 (just like using the triangle_map pigment option).  This
  439. is the default if spray_loop is true; otherwise, the default value for
  440. color_map_triangle is false.
  441.  
  442. 3.8.5  color_map_frequency
  443. **************************
  444. Normally the first color of the spray_color_map is used at the beginning
  445. of the spray, and the last color is used at the end of the spray.  You can
  446. change this option to have the color_map repeat itself more than once
  447. through the life of the spray object, using color_map_frequency = 5 will
  448. make the color_map loop through 5 times.
  449.  
  450. 3.9  TURBULENCE OPTIONS
  451. ***********************
  452. The options is this section can be used to add randomness to certain
  453. aspects of the spray object.  You can use these options to make the
  454. spray object more (or less) realistic.
  455.  
  456. 3.9.1  spray_turb
  457. ***************
  458. This option controls the overall amount of turbulence added to the
  459. spray object.  Good values range from 0 (no turbulence) to 1 (lots of
  460. turbulence), but any value can be used.  Changing this value will add
  461. equal turbulence to all aspects of the spray object.  If you wish to
  462. adjust the turbulence of individual areas of the spray object you can use
  463. the following parameters.   (Note that all the individual turbulence
  464. options are multiplied by spray_turb to find the final turbulence, so you
  465. will have to make sure that spray_turb is not 0 before using the other
  466. turbulence options).
  467. The default value for spray_turb is 0
  468.  
  469. 3.9.2  scale_turb
  470. *****************
  471. This option controls the amount of turbulence added to the scaling of the
  472. spray particles.  It is specified as a factor of the particle size,
  473. eg. scale_turb = .5 will give particles scaled up to 50% larger or smaller
  474. than normal.
  475.  
  476. 3.9.3  vel_turb
  477. ***************
  478. This option controls the amount of turbulence added to the velocity of the
  479. particles.  It is specified as a factor of the particle velocity,
  480. eg. vel_turb = .3 will give particles with velocities up to 30% more or
  481. less than normal.
  482.  
  483. 3.9.4  angle_turb
  484. *****************
  485. This option controls the amount of turbulence added to the nozzle angle.
  486. It is specified as a fraction of the nozzle_angle option, eg.
  487. angle_turb = .4 will give particles with nozzle angles up to 40% more
  488. or less than normal.
  489.  
  490. 3.9.5  spin_turb
  491. ****************
  492. This option controls the amount of turbulence added to the nozzle spin.
  493. It is specified as a fraction of 360 degrees, eg. spin_turb = .1 will
  494. give particles that spin up to 36 degrees away from normal.
  495.  
  496. 3.9.6  color_turb
  497. *****************
  498. This option controls the amount of turbulence added to the color_map.
  499. color_turb = 1 means that colors will be picked randomly from the
  500. spray_color_map to color each particle.
  501.  
  502. 3.9.7  wind_turb
  503. ****************
  504. This option controls the amount of turbulence added to the wind direction.
  505. It is specified as a fraction of 360 degrees, eg. wind_turb = .2 will
  506. give particles that are blown up to 72 degrees away from normal.
  507.  
  508. 3.9.8  spray_seed
  509. *****************
  510. This option specifies that random number seed used when adding turbulence to
  511. the spray object.  Normally this is 0, but any integer value can be used.
  512.  
  513.  
  514. 3.10  OTHER OPTIONS
  515. *******************
  516.  
  517. 3.10.1  spray_clock
  518. *******************
  519. This option specifies the clock value you want to use to generate the
  520. spray object.  By default this is equal to POVRay's internal clock, so
  521. you shouldn't normally have to use this option.  However, there are a
  522. number of interesting effects you can achieve by using the spray_clock.
  523. If you use spray_clock = .6, you will get a still scene of the spray
  524. object, as it would look at .6 units of time.  You can also use functions
  525. of the internal clock, eg:
  526.  
  527.    #declare spray_clock = 1 - clock
  528.  
  529. will give you a spray object that animates backwards.
  530.  
  531. 3.10.2  time_scale
  532. ******************
  533. This option behaves differently, depending on the spray_loop option.  If
  534. spray_loop is true, then time_scale changes the time taken for the spray
  535. object to complete one loop, eg. time_scale = 3 will make the spray object
  536. loop three times per unit of time, rather than once.
  537. If spray_loop is false, then time_scale gives the effect of increasing (if
  538. you use a number larger than 1) or decreasing (if you use a number smaller
  539. than 1) the speed of the spray_particles.  However, it has no effect
  540. on the spray_start, spray_stop, spray_start_time, or spray_stop_time
  541. options.
  542. The default value for time_scale is 1
  543.  
  544. 3.10.3  flow_rate
  545. *****************
  546. This option can be used to change the flow rate of the spray object, where
  547. 0 is off and 1 is full strength.  Numbers between 0 and 1 give less than
  548. full strength, while numbers larger than 1 give more than full strength.
  549. Normally if you want to turn the spray object on or off you will use the
  550. options listed in section 3.2.  However, you can use the flow_rate option
  551. to create different effects, eg:
  552.  
  553.    #declare flow_rate = sin(clock * 4 * pi) * .5 + 1
  554.  
  555. will give an oscillating spray object.
  556.  
  557.  
  558. 4.0  COPYRIGHT AND LEGAL INFORMATION
  559. **************************************************************************
  560. The Liquid Spray Include File, including Spray.inc, SprayG.inc, all
  561. documentation, and associated sample POV files are Copyright 1997 by
  562. Chris Colefax.  Full permission is granted to the user to modify any or
  563. all of the files for his/her own use.  If modified versions are to be
  564. distributed the user should make clear the modifications that have been
  565. made by him/herself.  The Liquid Spray Include File may be bundled with
  566. or without other software on CD-ROM collections, Bulletin Board systems
  567. and other file archives, providing that all associated files, including
  568. documentation and samples, are included.  I would also request that persons
  569. intending to distribute the Liquid Spray Include File in this manner or
  570. otherwise would first contact me (see below for contact information) to
  571. ensure that they are in possession of the latest version.
  572.  
  573.  
  574. 5.0  CONTACTING THE AUTHOR
  575. **************************************************************************
  576. If you wish to contact me with bug reports, bug fixes, criticisms, 
  577. comments, suggested improvements, questions, etc. you can reach me by 
  578. email at:
  579.  
  580.    ccolefax@geocities.com
  581.  
  582. or by regular mail at:
  583.  
  584.    Chris Colefax
  585.    PO Box 110
  586.    Kuranda, Queensland
  587.    Australia  4872
  588.  
  589. **************************************************************************
  590.  
  591. POV-Ray(tm) and Persistence of Vision(tm) are registered trademarks of the
  592. POV-Ray Team(tm)
  593.